<template>
    <a-modal 
    class="my-modal short" 
    v-model:visible="modal_show" 
    title="历史选择" 
    @ok="modelok" 
    width="70%" 
    :maskClosable="false" 
    :centered="true"
    :destroyOnClose="true"
    >
        <a-select v-model:value="history" style="width: 100%">
            <a-select-option :value="item" :key="index" v-for="(item,index) in historys"></a-select-option>
        </a-select>
    </a-modal>
</template>
<script>
export default {
    data() {
        return {
            modal_show: false,
            historys:[],
            history:"",

            //
            mitt_select_history_id:"",
            mitt_select_history_back_id:"",

        };
    },
    beforeUnmount() {
        this.$mitt.off('select_history',this.mitt_select_history_id);
    },
    mounted() { 
        this.mitt_select_history_id=this.$mitt.on('select_history',(uid,_historys)  => {
            this.mitt_select_history_back_id=uid
            this.historys = _historys;
            this.modal_show = true;
        });
    },
    methods: {
        async modelok() {
            this.$mitt.oemit('select_history_back',this.history,this?.mitt_select_history_back_id);
            this.modal_show = false;
        },
    },
};
</script>